package legumes.client.resources;

import legumes.shared.domain.PaiementModeEnum;
import legumes.shared.domain.PaiementModes;

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;

public interface PNResources extends ClientBundle {

	PNResources INSTANCE = GWT.create(PNResources.class);
	
	final static String PRODUCT_NAME_CSS_PREFIX= "product";
	final static String PRODUCT_VARIETY_CSS_PREFIX  = "variety";
	final static String PRODUCT_CATEGORY_CSS_PREFIX = "category";
	
	public class PaiementModeImageResource{
		public static ImageResource getPaiementModeImageResource(PaiementModeEnum paiementModeEnum_){
			ImageResource imgRes = null;
			switch(paiementModeEnum_){
				case AMERICAN_EXPRESS : 
					imgRes = PNResources.INSTANCE.paiementModeAmericanExpressIcon();
					break;
				case MASTER_CARD : 
					imgRes = PNResources.INSTANCE.paiementModeMasterCardIcon();
					break;
				case MAESTRO : 
					imgRes = PNResources.INSTANCE.paiementModeMaestroIcon();
					break;
				case VISA : 
					imgRes = PNResources.INSTANCE.paiementModeVisaIcon();
					break;
				case TITRES_RESTAURANTS : 
					imgRes = PNResources.INSTANCE.paiementModeTitreRestaurantIcon();
					break;
				case CHEQUE : 
					imgRes = PNResources.INSTANCE.paiementModeChequeIcon();
					break;
				case MONNAIE : 
					imgRes = PNResources.INSTANCE.paiementModeMonnaieIcon();
					break;
			}
			return imgRes;
		}
		
		public static Widget getAllPaiementModeImageResourceAsWidget(PaiementModes pm_, boolean addNewLineForEachCategory_){
			FlexTable ftRow = new FlexTable();
			FlexTable ftcol = new FlexTable();
			ftcol.setHeight("19px");
			int col=0;
			int row = 0;
			PaiementModeEnum pmePrec = null;
			for(PaiementModeEnum pme : pm_.getPaiementModes()){
				if (pmePrec != null && ( ! pmePrec.isTheSameCategoryOfPaiement(pme) && addNewLineForEachCategory_) ){
					ftRow.setWidget(row, 0, ftcol);
					ftcol = new FlexTable();
					ftcol.setHeight("19px");
					row++;
					col=0;
				}
				Image img = new Image(getPaiementModeImageResource(pme));
				String condition = pm_.getPaiementModeCondition(pme);
				if(condition==null){
					condition = pme.getDisplayName();
				} else {
					condition = pme.getDisplayName() + ": " + condition;
				}
				img.setAltText( pme.getDisplayName() );
				img.setTitle( condition );
				ftcol.setWidget(0, col, img);
				col++;
				pmePrec = pme;
			}
			if (pmePrec != null){
				ftRow.setWidget(row, 0, ftcol);
			}
			return ftRow;
		}
	}
	
	@Source("images/logoMain.png")
	ImageResource logoPrincipal();
	
	@Source("images/paiementModeTitreRestaurantIcon.png")
	ImageResource paiementModeTitreRestaurantIcon();
	
	@Source("images/paiementModeMonnaieIcon.png")
	ImageResource paiementModeMonnaieIcon();
	
	@Source("images/paiementModeChequeIcon.png")
	ImageResource paiementModeChequeIcon();
	
	@Source("images/paiementModeMasterCardIcon.png")
	ImageResource paiementModeMasterCardIcon();
	
	@Source("images/paiementModeMaestroIcon.png")
	ImageResource paiementModeMaestroIcon();
	
	@Source("images/paiementModeVisaIcon.png")
	ImageResource paiementModeVisaIcon();
	
	@Source("images/paiementModeAmericanExpressIcon.png")
	ImageResource paiementModeAmericanExpressIcon();

	@Source("images/ViewDetailsIcon.png")
	ImageResource viewDetailsIcon();
	
	@Source("images/validateIcon.png")
	ImageResource validateIcon();
	
	@Source("images/addIcon.gif")
	ImageResource addIcon();
	
	@Source("images/deleteIcon.gif")
	ImageResource deleteIcon();
	
	@Source("images/loadingAnimIcon.gif")
	ImageResource loadingAnimIcon();
	
	@Source("images/lockEditIcon.gif")
	ImageResource lockEditIcon();
	
	@Source("images/unlockIcon.gif")
	ImageResource unLockIcon();
	
	@Source("images/lockYellowIcon.png")
	ImageResource lockYellowIcon();
	
	@Source("images/logoutIcon.gif")
	ImageResource logoutIcon();
	
	@Source("images/userAloneIcon.gif")
	ImageResource userAloneIcon();
	
	@Source("images/userAddIcon.gif")
	ImageResource userAddIcon();
	
	@Source("images/userDeleteIcon.gif")
	ImageResource userDeleteIcon();
	
	@Source("images/loadFromEmailIcon.png")
	ImageResource loadFromEmailIcon();
	
	@Source("images/excelExport.png")
	ImageResource excelExport();
	
	@Source("images/marketOpenIcon.png")
	ImageResource marketOpenIcon();
	
	@Source("images/marketCloseIcon.png")
	ImageResource marketCloseIcon();
	
	@Source("images/emailImportIcon.png")
	ImageResource emailImportIcon();
	
	@Source("images/titresRestaurantImg.jpg")
	ImageResource titresRestaurantImg();
	
	@Source("images/excelIcon.jpg")
	ImageResource excelIcon();
	
	@Source("images/shoppingChart.png")
	ImageResource shoppingChartIcon();
	
	@Source("images/receipe.png")
	ImageResource receipeIcon();

	@Source("images/cancelIcon.gif")
	ImageResource cancelIcon();

	@Source("images/editIcon.png")
	ImageResource editIcon();
	
	@Source("images/lockOpenIcon.gif")
	ImageResource lockOpenIcon();
	
	@Source("images/storeIcon.png")
	ImageResource storeIcon();
	
	@Source("images/deliveryIcon.png")
	ImageResource deliveryIcon();
	
	@Source("images/mapIcon.gif")
	ImageResource mapIcon();

	@Source("images/gmaps/gmapDeliveringAtHomeIcon.png")
	ImageResource gmapDeliveringAtHomeIcon();

	@Source("images/gmaps/gmapDeliveringAtMarketIcon.png")
	ImageResource gmapDeliveringAtMarketIcon();

	@Source("images/gmaps/deliveringAtHomeIcon.png")
	ImageResource deliveringAtHomeIcon();

	@Source("images/gmaps/deliveringAtMarketIcon.png")
	ImageResource deliveringAtMarketIcon();

	@Source("images/gmaps/gmapResizerCircleMarkerIcon.png")
	ImageResource gmapResizerCircleMarkerIcon();
}
